<?php include $this->admin_tpl('meta');?>
<title>基础</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 基础 <span class="c-gray en">&gt;</span> 聚水潭列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
	<div class="cl tb-top"> <span class="l">
		<a href="javascript:;" onclick="yzm_open('添加模型','<?php echo U('jst_add');?>','650','485')" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加聚水潭</a>
	</span></div>
	<table class="table table-border table-bg table-hover">
		<thead>
			<tr class="text-c">
				<th>ID</th>
				<th class="text-l">公司名称</th>
				<th>公司简称</th>
				<th class="text-l">app_key</th>
				<th class="text-l">app_secret</th>		
				<th class="text-l">access_token</th>
				<th class="text-l">refresh_token</th>
				<th>开始时间<span class="yzm-explain-box"><span class="yzm-explain">需要的商品资料最早建立时间</span></span></th>
				<th>令牌过期时间</th>
				<th>是否自有商城</th>
				<th>是否启用</th>
				<th>管理操作</th>
			</tr>
		</thead>
		<tbody>
			<?php 
			   foreach($data as $val){
			 ?>
			<tr class="text-c">
				<td><?php echo $val['id'];?></td>
				<td class="text-l w_150"><?php echo $val['company'];?></td>
				<td><?php echo $val['short_name'];?></td>
				<td><span class="ell w_100"><?php echo $val['app_key'];?></span></td>
				<td><span class="ell w_100"><?php echo $val['app_secret'];?></span></td>
				<td><span class="ell w_100"><?php echo $val['access_token'];?></span></td>
				<td><span class="ell w_100"><?php echo $val['refresh_token'];?></span></td>
				<td><?php echo date('Y-m-d',$val['start_time']);?></td>
				<td><?php echo date('Y-m-d H:i:s',$val['expires_in']);?></td>
				<td>
					<?php if($val['is_ziyou']){ ?>
					<span class="yzm-status-enable" data-field="is_ziyou" data-text="是|否" data-db="jst_list" data-id="<?php echo $val['id'];?>" onclick="yzm_change_status(this,'public_change_status')"><i class="yzm-iconfont">&#xe81f;</i>是</span>
					<?php }else{ ?>
					<span class="yzm-status-disable" data-field="is_ziyou" data-text="是|否" data-db="jst_list" data-id="<?php echo $val['id'];?>" onclick="yzm_change_status(this,'public_change_status')"><i class="yzm-iconfont">&#xe601;</i>否</span>
					<?php } ?>
				</td>
				<td>
					<?php if($val['status']){ ?>
					<span class="yzm-status-enable" data-field="status" data-text="是|否" data-db="jst_list" data-id="<?php echo $val['id'];?>" onclick="yzm_change_status(this,'public_change_status')"><i class="yzm-iconfont">&#xe81f;</i>是</span>
					<?php }else{ ?>
					<span class="yzm-status-disable" data-field="status" data-text="是|否" data-db="jst_list" data-id="<?php echo $val['id'];?>" onclick="yzm_change_status(this,'public_change_status')"><i class="yzm-iconfont">&#xe601;</i>否</span>
					<?php } ?>
				</td>
				<td class="td-manage">
					<a title="编辑"  class="btn-mini btn-success ml-5" href="javascript:;" onclick="yzm_open('编辑模型','<?php echo U('jst_add',array('id'=>$val['id']));?>','650','485')" style="text-decoration:none">编辑</a>
					<a href="<?php echo $val['url'];?>" target="_blank" class="btn-mini btn-primary radius">获取令牌</a>
					<a href="javascript:" target="_blank" class="btn-mini btn-primary radius" onclick="get_wms(<?php echo $val['id'];?>)">获取仓库</a>
					<!--<a href="" target="_blank" class="btn-mini btn-warning radius">重获令牌</a>-->
					<a title="删除" href="javascript:;" onclick="yzm_confirm('<?php echo U('jst_delete',array('id'=>$val['id']));?>', '确定要删除【<?php echo $val['company'];?>】吗？<br><span style=\'color:#ee3b3b\'><span class=\'yzm-iconfont yzm-iconshuoming\'></span> 删除聚水潭的所有数据！</span>',1,0)"  class="btn-mini btn-danger ml-5" style="text-decoration:none">删除</a>
				</td>
			</tr>
			<?php 
			   }		 
			?>	
		</tbody>
	</table>
	<?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
</div>
<?php include $this->admin_tpl('footer');?>
<script>
function get_wms(jst_id){
	layer.load();
	$.ajax({
		type: 'get',
		url: '<?php echo U('get_wms');?>?jst_id='+jst_id,
		data:$('#search').serialize(),
		dataType: "json",
		success: function (res) {
			layer.closeAll('loading');
			if(res.code==0){
				layer.msg(res.msg, {icon:1, time:1000}, function(){
					location.reload();
				});
			}else{
				layer.msg(res.msg, {icon:2});
			}
		}
	})
}
</script>
</body>
</html>